<?php
define('ITEMS',5);
define('COLS',4);

$count = 1;
$rows = ceil(ITEMS / COLS );
?>
<table border="1" width="80%">
<?php
for ($i = 1; $i <= $rows; $i++)
{
?>
  <tr>
<?php
  for ($j = 1; $j <= COLS; $j++)
  {
    if($count <= ITEMS) {
?>
      <td>Hello <?=$count++?></td>
<?php
    } else {//end if
      echo "<td>No (X)</td>";
    }//end else
  }// end for for j
?>
  </tr>
<?php
}// end for for i
?>
</table>
